//
//  BoozeCompanyVC.m
//  VeganIsEasy
//
//  Created by Matthew Feinberg on 2/10/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "BoozeCompanyVC.h"
#import "BoozeProductVC.h"
#import "BoozeUtils.h"


@implementation BoozeCompanyVC

//@synthesize products, generalInformation, address, booze_type, checked_by, city, company_name, country, created_on, email, fax, notes, phone, red_yellow_green, status, tag, updated_on, url, barnivore_company_url, doubled_by, state, postal, editor, region;
@synthesize status, booze_type, barnivore_company_url, color, products, generalInformation, companyDetails, notes;

- (id)initWithCompanyId:(NSInteger)primaryKey database:(sqlite3 *)db {
	if (self = [super initWithStyle:UITableViewStyleGrouped]) {
		companyId = primaryKey;
		database = db;
	}
	return self;
}

/*
- (id)initWithStyle:(UITableViewStyle)style {
    // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
    if (self = [super initWithStyle:style]) {
    }
    return self;
}
*/

- (void)populateCompanyInformation {
	char *sql = "SELECT address, booze_type, checked_by, city, company_name, country, created_on, email, fax, notes, phone, red_yellow_green, status, tag, updated_on, url, barnivore_company_url, doubled_by, state, postal, editor, region FROM company WHERE id=?";
	sqlite3_stmt *statement = nil;
	//	NSMutableArray *newArray = [[NSMutableArray alloc] init];
	self.generalInformation = [NSMutableArray array]; //newArray;
	self.companyDetails = [NSMutableArray array];
	//	[newArray release];
	
	if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) {
		sqlite3_bind_int(statement, 1, companyId);
		if (sqlite3_step(statement) == SQLITE_ROW) {
			char* tmp;
			tmp = (char *)sqlite3_column_text(statement, 4);
			if (tmp != NULL) {
				[generalInformation addObject:[NSArray arrayWithObjects:@"Company",[NSString stringWithUTF8String:tmp],nil]];
				self.navigationItem.title = [NSString stringWithUTF8String:tmp];
			}
			tmp = (char *)sqlite3_column_text(statement, 12);
			if (tmp != NULL) {
				self.status = [NSString stringWithUTF8String:tmp];
				[generalInformation addObject:[NSArray arrayWithObjects:@"Status",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 1);
			if (tmp != NULL) {
				self.booze_type = [NSString stringWithUTF8String:tmp];
				//[generalInformation addObject:[NSArray arrayWithObjects:@"Type",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 0);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"Address",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 3);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"City",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 18);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"State",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 21);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"Region",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 19);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"Postal",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 5);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"Country",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 10);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"Phone",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 8);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"Fax",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 7);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"Email",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 15);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"URL",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 16);
			if (tmp != NULL) {
				self.barnivore_company_url = [NSString stringWithUTF8String:tmp];
				[companyDetails addObject:[NSArray arrayWithObjects:@"URL2",@"Barnivore Web Page",nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 2);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"Checker",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 17);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"Rechecker",[NSString stringWithUTF8String:tmp],nil]];
			}			
			tmp = (char *)sqlite3_column_text(statement, 6);
			if (tmp != NULL) {
				NSString *dateString = [BoozeUtils formatDateString:[NSString stringWithUTF8String:tmp]];
				if (dateString != nil) {
					[companyDetails addObject:[NSArray arrayWithObjects:@"Added",dateString,nil]];
				}
			}
			tmp = (char *)sqlite3_column_text(statement, 14);
			if (tmp != NULL) {
				NSString *dateString = [BoozeUtils formatDateString:[NSString stringWithUTF8String:tmp]];
				if (dateString != nil) {
					[companyDetails addObject:[NSArray arrayWithObjects:@"Updated",dateString,nil]];
				}
			}
			tmp = (char *)sqlite3_column_text(statement, 9);
			if (tmp != NULL) {
				self.notes = [NSString stringWithUTF8String:tmp];
				//[companyDetails addObject:[NSArray arrayWithObjects:@"Notes",[NSString stringWithUTF8String:tmp],nil]];
			}
			tmp = (char *)sqlite3_column_text(statement, 11);
			if (tmp != NULL) {
				self.color = [[NSString stringWithUTF8String:tmp] lowercaseString];
				//[companyDetails addObject:[NSArray arrayWithObjects:@"Color",[NSString stringWithUTF8String:tmp],nil]];
			}
			/*
			tmp = (char *)sqlite3_column_text(statement, 13);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"Tag",[NSString stringWithUTF8String:tmp],nil]];
			}
			 */
			tmp = (char *)sqlite3_column_text(statement, 20);
			if (tmp != NULL) {
				[companyDetails addObject:[NSArray arrayWithObjects:@"Editor",[NSString stringWithUTF8String:tmp],nil]];
			}
		}
	}
	sqlite3_finalize(statement);
}

- (void)populateProductInformation {
	char *sql = "SELECT display_name, id, product_status FROM product WHERE company_id=? AND visible='Y' ORDER BY display_name";
	sqlite3_stmt *statement = nil;
	self.products = [NSMutableArray array];
	
	if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) {
		sqlite3_bind_int(statement, 1, companyId);
		while (sqlite3_step(statement) == SQLITE_ROW) {
			char* tmp;
			
			tmp = (char *)sqlite3_column_text(statement, 0);
			if (tmp == NULL) {continue;} // All fields must not be null for products
			NSString *displayName = [NSString stringWithUTF8String:tmp];

			NSNumber *productId = [NSNumber numberWithInteger:sqlite3_column_int(statement, 1)];
			
			tmp = (char *)sqlite3_column_text(statement, 2);
			if (tmp == NULL) {continue;} // All fields must not be null for products
			NSString *productStatus = [NSString stringWithUTF8String:tmp];
			
			[products addObject:[NSArray arrayWithObjects:displayName,productId,productStatus,nil]];			
		}
	}
	sqlite3_finalize(statement);
}

- (void)viewDidLoad {
    [super viewDidLoad];

	[self populateCompanyInformation];
 	[self populateProductInformation];

	generalInformationSection = 0;
	productsSection = [products count] > 0 ? 1 : -1;
	notesSection = productsSection >= 0 ? productsSection + 1 : 1;
	companyDetailsSection = notesSection + 1;
}

/*
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}
*/
/*
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
}
*/
/*
- (void)viewWillDisappear:(BOOL)animated {
	[super viewWillDisappear:animated];
}
*/
/*
- (void)viewDidDisappear:(BOOL)animated {
	[super viewDidDisappear:animated];
}
*/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


#pragma mark Table view methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
	return companyDetailsSection+1;
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
	if (section == generalInformationSection) {
		return 2;
	}
	else if (section == productsSection) {
		return [products count];
	}
	else if (section == companyDetailsSection) {
		return [companyDetails count];
	}
	else if (section == notesSection) {
		return notes == nil || [notes length] < 1 ? 0 : 1;
	}
	else {
		return 0;
	}
}

- (UIImage *)statusIcon {
	NSString *iconName = nil;
	if ([color isEqualToString:@"red"]) {
		iconName = [NSString stringWithFormat:@"%@_not_vegan_icon_small.png",[booze_type lowercaseString]];
	}
	else if ([color isEqualToString:@"yellow"]) {
		iconName = [NSString stringWithFormat:@"%@_some_vegan_icon_small.png",[booze_type lowercaseString]];
	}
	else {
		iconName = [NSString stringWithFormat:@"%@_vegan_icon_small.png",[booze_type lowercaseString]];
	}
	if (iconName != nil) {
		return [UIImage imageNamed:iconName];
	}
	return nil;
}

// Produce cells
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	NSInteger row = [indexPath row];
	NSInteger section = [indexPath section];
	UITableViewCell *cell;

	if (section == generalInformationSection) {
		if (row == 0) {
			cell = [tableView dequeueReusableCellWithIdentifier:@"titleCell"];
			if (!cell) {
				cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"titleCell"] autorelease];
				[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
				UIView *transparentBackground = [[UIView alloc] initWithFrame:CGRectZero];
				transparentBackground.backgroundColor = [UIColor clearColor];
				cell.backgroundView = transparentBackground;
				[[cell textLabel] setBackgroundColor:[UIColor clearColor]];
				[[cell detailTextLabel] setBackgroundColor:[UIColor clearColor]];
				[[cell textLabel] setText:[[generalInformation objectAtIndex:row] objectAtIndex:1]];
				[[cell detailTextLabel] setText:booze_type];
				
				[[cell detailTextLabel] setFont:[[cell.detailTextLabel font] fontWithSize:[UIFont smallSystemFontSize]]];
				
			}
			return cell;
			
		}
		else if (row == 1) {
			cell = [tableView dequeueReusableCellWithIdentifier:@"statusCell"];
			if (!cell) {
				cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"statusCell"] autorelease];
				[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
				UIView *transparentBackground = [[UIView alloc] initWithFrame:CGRectZero];
				transparentBackground.backgroundColor = [UIColor clearColor];
				cell.backgroundView = transparentBackground;
				[[cell textLabel] setBackgroundColor:[UIColor clearColor]];
				//				[[cell detailTextLabel] setBackgroundColor:[UIColor clearColor]];
				[[cell imageView] setImage:[self statusIcon]];
				[[cell textLabel] setText:[[generalInformation objectAtIndex:row] objectAtIndex:1]];

				[[cell textLabel] setFont:[[cell.textLabel font] fontWithSize:[UIFont smallSystemFontSize]]];
				[[cell textLabel] setTextColor:[UIColor grayColor]];

			}
			return cell;
			
		}
		else {
			cell = [tableView dequeueReusableCellWithIdentifier:@"generalInformationCell"];
			if (!cell) {
				cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:@"generalInformation"] autorelease];
				[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
				UIView *transparentBackground = [[UIView alloc] initWithFrame:CGRectZero];
				transparentBackground.backgroundColor = [UIColor clearColor];
				cell.backgroundView = transparentBackground;
				[[cell textLabel] setBackgroundColor:[UIColor clearColor]];
				[[cell detailTextLabel] setBackgroundColor:[UIColor clearColor]];
			}
			[[cell textLabel] setText:[[generalInformation objectAtIndex:row] objectAtIndex:0]];
			[[cell detailTextLabel] setText:[[generalInformation objectAtIndex:row] objectAtIndex:1]];
			return cell;
		}
			/*
			if (row == 0) {
				// Add a text field to the cell
				cell = [tableView dequeueReusableCellWithIdentifier:@"textCell"];
				if (!cell) {
					cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"textCell"] autorelease];
					UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20.0f, 10.0f, 100.0f, 20.0f)];
					[label setText:@"Name:"];
					[cell addSubview:label]; [label release];
					[cell addSubview:[[UITextField alloc] initWithFrame:CGRectMake(20.0f, 40.0f, 280.0f, 30.0f)]];
				}
				//UITextField *tf = [[cell subviews] lastObject];
				//tf.placeholder = @"Enter Your Name Here";
				//tf.delegate = self;
				//tf.borderStyle = UITextBorderStyleBezel;
				return cell;
			}
			if (row == 1) {
				// Create a big word-wrapped UILabel
				cell = [tableView dequeueReusableCellWithIdentifier:@"libertyCell"];
				if (!cell) {
					cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"libertyCell"] autorelease];
					[cell addSubview:[[UILabel alloc] initWithFrame:CGRectMake(20.0f, 10.0f, 280.0f, 330.0f)]];
				}
				UILabel *sv = [[cell subviews] lastObject];
				sv.text = @"When in the Course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature’s God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.";
				sv.textAlignment = UITextAlignmentCenter;
				sv.lineBreakMode = UILineBreakModeWordWrap;
				sv.numberOfLines = 9999;
				return cell;
			}
			 */
	}
	else if (section == productsSection) {
		cell = [tableView dequeueReusableCellWithIdentifier:@"productCell"];
		if (!cell) {
			cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"productCell"] autorelease];
//			cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"productCell"] autorelease];
			cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
		}
		[[cell textLabel] setText:[[products objectAtIndex:row] objectAtIndex:0]];
		NSString *productStatus = [[products objectAtIndex:row] objectAtIndex:2];
		
		NSString *iconName;
		if ([productStatus isEqualToString:@"Vegan Friendly"]) {
			iconName = [NSString stringWithFormat:@"%@_vegan_icon_small.png",[booze_type lowercaseString]];
//			[[cell detailTextLabel] setTextColor:[UIColor greenColor]];
//			[[cell detailTextLabel] setText:@"V"];
		}
		else  {
			iconName = [NSString stringWithFormat:@"%@_not_vegan_icon_small.png",[booze_type lowercaseString]];
//			[[cell detailTextLabel] setTextColor:[UIColor redColor]];
//			[[cell detailTextLabel] setText:@"NV"];
		}
		[[cell imageView] setImage:[UIImage imageNamed:iconName]];
		return cell;
	}
	else if (section == companyDetailsSection) {
		NSString *field = [[companyDetails objectAtIndex:row] objectAtIndex:0];
		if (field == @"Email" || field == @"URL" || field == @"URL2") {
			cell = [tableView dequeueReusableCellWithIdentifier:@"companyDetailLinkCell"];
			if (!cell) {
				cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:@"companyDetailLinkCell"] autorelease];
				//[[cell detailTextLabel] setTextColor:[UIColor blueColor]];
				cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//				[[cell detailTextLabel] setFont:
			}
		}
		else {
			cell = [tableView dequeueReusableCellWithIdentifier:@"companyDetailCell"];
			if (!cell) {
				cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:@"companyDetailCell"] autorelease];
				[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
			}			
		}
		[[cell textLabel] setText:field];
		[[cell detailTextLabel] setText:[[companyDetails objectAtIndex:row] objectAtIndex:1]];
		return cell;
	}
	else if (section == notesSection) {
		// Create a big word-wrapped UILabel
		cell = [tableView dequeueReusableCellWithIdentifier:@"notesCell"];
		if (!cell) {
			cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"notesCell"] autorelease];
			//[cell addSubview:[[UILabel alloc] initWithFrame:CGRectMake(20.0f, 10.0f, 280.0f, 330.0f)]];
			[[cell textLabel] setFont:[cell.textLabel.font fontWithSize:14.0f]];
			UILabel *sv = [cell textLabel];//[[cell subviews] lastObject];
			sv.text = notes;//@"When in the Course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature’s God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.";
			//		sv.textAlignment = UITextAlignmentCenter;
			sv.lineBreakMode = UILineBreakModeWordWrap;
			sv.numberOfLines = 9999;
			[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
//			[[cell textLabel] sizeToFit];
		}
		return cell;
	}
	
	// Return a generic cell if all else fails
	cell = [tableView dequeueReusableCellWithIdentifier:@"any-cell"];
	if (cell == nil) {
		cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"any-cell"] autorelease];
	}
	return cell;
}

// Heights per row
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
	int section = [indexPath section];
	int row = [indexPath row];
	
	if (section == notesSection && row == 0) {
		CGSize theSize = [notes sizeWithFont:[UIFont systemFontOfSize:16.0f] constrainedToSize:CGSizeMake(280.0f, FLT_MAX) lineBreakMode:UILineBreakModeWordWrap];
		return theSize.height;
	}
	
	return 44.0f;
}

/*				
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }
    
    // Set up the cell...
	
    return cell;
}
*/

// Section Titles
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
	if (section == generalInformationSection) {
		return @"";
	}
	else if (section == productsSection) {
		return @"Products";
	}
	else if (section == companyDetailsSection) {
		return @"Company Details";
	}
	else if (section == notesSection) {
		return @"Notes";
	}
	else {
		return @"";
	}
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	NSInteger row = [indexPath row];
	NSInteger section = [indexPath section];
	if (section == productsSection && [products count] > 0) {
		BoozeProductVC *productViewController = [[BoozeProductVC alloc]  initWithProductId:[[[products objectAtIndex:row] objectAtIndex:1] integerValue] database:database];
		[self.navigationController pushViewController:(UIViewController *)productViewController animated:YES];
		[productViewController release];
	}
	else if (section == companyDetailsSection) {
		NSString *field = [[companyDetails objectAtIndex:row] objectAtIndex:0];
		if (field == @"URL") {
			[BoozeUtils openUrlString:[[companyDetails objectAtIndex:row] objectAtIndex:1]];
		}
		else if (field == @"URL2") {
			[BoozeUtils openUrlString:barnivore_company_url];
		}
		else if (field == @"Email") {
			[BoozeUtils openUrlString:[NSString stringWithFormat:@"mailto:%@",[[companyDetails objectAtIndex:row] objectAtIndex:1],nil]];
		}
	}
	
    // Navigation logic may go here. Create and push another view controller.
	// AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
	// [self.navigationController pushViewController:anotherViewController];
	// [anotherViewController release];
}


/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/


/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
    }   
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/


/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/


/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/


- (void)dealloc {
    [super dealloc];
}


@end

